﻿<%@ Page Title="" Language="VB" MasterPageFile="~/App/Master/App.master" AutoEventWireup="false" CodeFile="FollowersList.aspx.vb" Inherits="App_FollowersList" %>


<asp:Content ID="Content1" ContentPlaceHolderID="CphHead" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphMainContent" runat="Server">
    <asp:ScriptManagerProxy runat="server">
        <Scripts>
            <asp:ScriptReference Path="https://www.google.com/jsapi" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <script type="text/javascript">

        google.load('visualization', '1.0', { 'packages': ['geochart'] });
        google.load("visualization", "1", { packages: ["corechart"] });


        $(function () {



            SetUI();
            on_update_panel_server(function () {
                SetUI();
            });

        });

        function SetUI() {

            $(".chosen-select").chosen();

            $("#TxtBeginDate").datepicker({
                dateFormat: 'yy-mm-dd',
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1,
                onClose: function (selectedDate) {
                    $("#TxtEndDate").datepicker("option", "minDate", selectedDate);
                }
            });
            $("#TxtEndDate").datepicker({
                dateFormat: 'yy-mm-dd',
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1,
                onClose: function (selectedDate) {
                    $("#TxtBeginDate").datepicker("option", "maxDate", selectedDate);
                }
            });


        }

        function DrawChartPostSend(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var options = {
                chartArea: { left: '8%', top: '5%', width: "80%", height: "80%" },
                focusTarget: 'category',
                lineWidth: 3, pointSize: 7, curveType: '',
                hAxis: { slantedText: false, maxAlternation: 1, maxTextLines: 1 },
                series: [
                    { targetAxisIndex: 0, color: '#29ABE2' },
                    { targetAxisIndex: 1, color: '#67B203' }
                ],
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }
            };

            var chart = new google.visualization.LineChart(document.getElementById('chart_div_post_send'));
            chart.draw(data, options);

        }

    </script>

    <div class="row">
        <asp:UpdatePanel ID="UpPConsole" runat="server" UpdateMode="Conditional" class="span12">
            <ContentTemplate>
                <div class="wrapper">
                    <h5 class="title titolo-cassetto">Manage Contacts</h5>
                    <span class="tips tips-3 right-top" data-tips="Tips">&nbsp;</span>

                    <div class="wrapper-inner">
                        <asp:Label runat="server" ID="LblReportDate"></asp:Label>

                        <asp:Button runat="server" CssClass="days" ID="RbtSearchLink" Text="link" CommandName="GROUP_SEARCH" CommandArgument="1" Style="width: 70px;" />
                        <asp:Button runat="server" CssClass="days" ID="RbtSearchHashtag" Text="hashtag" CommandName="GROUP_SEARCH" CommandArgument="3" Style="width: 70px;" />
                        <asp:Button runat="server" CssClass="days" ID="RbtSearchAutoFollow" Text="auto foll" CommandName="GROUP_SEARCH" CommandArgument="4" Style="width: 70px;" />
                        <asp:Button runat="server" CssClass="days" ID="RbtSearchMyReply" Text="my reply" CommandName="GROUP_SEARCH" CommandArgument="5" Style="width: 70px;" />

                        <asp:Button runat="server" ID="BtnExport" CssClass="xls-export" Text="search" />
                        <br />
                        <br />
                        From:
                        <asp:TextBox runat="server" ID="TxtBeginDate" CssClass=""></asp:TextBox>
                        To:
                        <asp:TextBox runat="server" ID="TxtEndDate" CssClass=""></asp:TextBox>
                        <br />
                        Username:
                        <asp:TextBox runat="server" ID="TxtUsername" CssClass=""></asp:TextBox>
                        Full name:
                        <asp:TextBox runat="server" ID="TxtFullname" CssClass=""></asp:TextBox>

                        <br />
                        <asp:Panel runat="server" ID="PnlSearchLink">
                            <div style="float: left; width: 600px;">
                                Link:
                                <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlLinkType" SelectionMode="Multiple" />
                                Categoria:
                                <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlCategories" SelectionMode="Multiple" />
                                <br />
                                Gender:
                                <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlGender" SelectionMode="Multiple" />
                                Business:
                                <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlBusiness" SelectionMode="Multiple" />
                                <br />
                                Language:
                                <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlLanguage" SelectionMode="Multiple" />
                                NOT Language:
                                <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlLanguageNot" SelectionMode="Multiple" />
                                <br />
                                Status:
                                <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlStatus" SelectionMode="Multiple" />
                            </div>
                            <div style="float: right; width: 300px;">
                                FILTER:<br />
                                <asp:TextBox runat="server" ID="TxtNewFilter" CssClass="" Style="width: 100px;"></asp:TextBox>
                                <asp:Button runat="server" CssClass="days" ID="BtnAddFilter" Text="Add" Style="width: 70px;" />
                                <br />
                                <asp:DropDownList runat="server" ID="DdlAccountFilter" Style="width: 113px;" AutoPostBack="true" />

                                <asp:Button runat="server" CssClass="days" ID="BtnSaveFilter" Text="Save" Style="width: 70px;" />
                                <asp:Button runat="server" CssClass="days" ID="BtnRemoveFilter" Text="Remove" Style="width: 70px;" />
                            </div>

                        </asp:Panel>
                        <%--                        <asp:Panel runat="server" ID="PnlSearchCategory">
                        </asp:Panel>--%>
                        <asp:Panel runat="server" ID="PnlSearchHashtag">
                            hashtag:
                            <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlHashtag" SelectionMode="Multiple" />
                            Link:
                                <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlLinkType2" SelectionMode="Multiple" />

                        </asp:Panel>
                        <asp:Panel runat="server" ID="PnlSearchAutoFollow">
                            Status:
                            <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlAutoFollStatus" SelectionMode="Multiple" />

                            Query:
                        <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlAutoFollQuery" SelectionMode="Multiple" />
                        </asp:Panel>
                        <div class="clearfix"></div>
                    </div>
                </div>


            </ContentTemplate>
        </asp:UpdatePanel>
    </div>


    <div class="row">
        <asp:UpdatePanel ID="UpPUser" runat="server" UpdateMode="Conditional" class="span12">
            <ContentTemplate>
                <div class="wrapper">
                    <h5 class="title">user:
                        <asp:Label runat="server" ID="LblUserFound" CssClass="num-interaction" Text="" />
                    </h5>
                    <span class="tips tips-3 right-top" data-tips="Tips">&nbsp;</span>
                    <div class="wrapper-inner">
                        <div id="chart_div_post_send" runat="server" style="height: 250px; width: 100%; overflow: hidden;">
                        </div>
                        <asp:GridView ID="GridUsers" Font-Size="12px" runat="server" CssClass="summary-results" ShowHeader="false" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="false">
                            <Columns>
                                <asp:TemplateField HeaderText="image" ItemStyle-CssClass="thumbsnail">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# eval("url") %>' Target="_blank">
                                            <img src="<%# eval("avatar") %>"  />
                                        </asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Nome" ItemStyle-CssClass="description" SortExpression="fullname">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# "https://twitter.com/" & eval("username") %>' Target="_blank">
                                            <asp:Label runat="server" Text='<%# eval("fullname") %>'></asp:Label>
                                        </asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="description" ItemStyle-CssClass="description" SortExpression="description">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# MyUI.Print .Post ( eval("description")) %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="location" SortExpression="location">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# eval("location") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="tweets" SortExpression="Post_Count">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# UI.Print.Num0(Eval("Post_Count"))%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="gender" SortExpression="">
                                    <ItemTemplate>
                                        <%--<asp:Label runat="server" Text='<%# mDB.Account.PrintGender(Eval("gender_type_id"))%>'></asp:Label>--%>
                                        <div>g:<%# MyApp.EnumToDic(Of mDB.Gender_Name.Type)(Eval("gender_type_id"))%></div>
                                        <div>s:<%# MyApp.EnumToDic(Of mDB.Account.StatusType)(Eval("status_type_id"))%></div>
                                        <div>b:<%# MyApp.EnumToDic(Of mDB.Account.BusinessType)(Eval("business_type_id"))%></div>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="buss/cons" SortExpression="" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>


                                        <%--<asp:Label runat="server" Text='<%# (eval("business_type_id")) %>'></asp:Label>--%>


                                        <div style="font-size: 10px; display: <%# IIf(Eval("business_type_id") =-1 , "none", "") %>; color: <%# IIf(Eval("business_type_id")= 2, "red", "black")%>;">
                                            <%--                                            <asp:Label runat="server" Text='<%# UI.Print.Num2(Eval("post_hours_activity_coeff"))%>'></asp:Label><br />--%>
                                            <asp:Label runat="server" Text='<%# UI.Print.Num2(mDB.Account.CalculateActivityCoeff(mDB.Account.GetActivityHours(Eval("post_hours_json"))))%>'></asp:Label><br />

                                            (<asp:Label runat="server" Text='<%# UI.Print.Num0(Eval("post_hours_total"))%>' ToolTip='<%# (Eval("post_hours_json"))%>'></asp:Label>)
                                        </div>

                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="" SortExpression="lang">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# eval("lang") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <AlternatingRowStyle CssClass="AlternatingRow Padding2" />
                            <HeaderStyle CssClass="Header" />
                            <RowStyle CssClass="Row Padding2" />
                            <PagerTemplate>
                                <%--<App:GridPager  ID="GridPager1" runat="server" />--%>

                            </PagerTemplate>
                        </asp:GridView>
                        <App:DataPager runat="server" id="pp" PageSize="100" Controlid="GridUsers" />

                        <asp:GridView ID="GridAccount" Font-Size="12px" runat="server" CssClass="summary-results" ShowHeader="true" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="True">
                            <Columns>
                                <asp:TemplateField HeaderText="Nome" ItemStyle-CssClass="" SortExpression="fullname">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# "https://twitter.com/" & Eval("account_username")%>' Target="_blank">
                                            @<asp:Label runat="server" Text='<%# Eval("account_username")%>'></asp:Label>
                                        </asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="post" SortExpression="">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# eval("post_count") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="follower" SortExpression="">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# eval("account_follower_count") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <AlternatingRowStyle CssClass="AlternatingRow Padding2" />
                            <HeaderStyle CssClass="Header" />
                            <RowStyle CssClass="Row Padding2" />
                            <PagerTemplate>
                                <%--<App:GridPager ID="GridPager1" runat="server" />--%>
                            </PagerTemplate>
                        </asp:GridView>
                        <asp:GridView ID="GridFollowStatus" runat="server" Width="100%" AutoGenerateColumns="false" CssClass="summary-results" ShowHeader="true" AllowSorting="true" >
                            <Columns>
                                <asp:TemplateField HeaderText="follow account" HeaderStyle-Width="250px">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# "https://twitter.com/" & eval("account_to_foll_username	") %>' Target="_blank">
                                <asp:Label runat="server" Text='<%# eval("account_to_foll_username") %>'></asp:Label>
                                        </asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Status" HeaderStyle-Width="150px" ItemStyle-HorizontalAlign="Center" SortExpression="Status_id">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Font-Bold="true" ID="LblStatus" Text=''></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Last update" HeaderStyle-Width="150px" ItemStyle-HorizontalAlign="Center" SortExpression="update_status_date">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Font-Size="11px" Text='<%# MyUI.Print.DateTimeShort(DBase.Conv.DateFromDB(Eval("update_status_date")))%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Foll" HeaderStyle-Width="150px" ItemStyle-HorizontalAlign="Center" SortExpression="follow_date">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Font-Size="11px" Text='<%# MyUI.Print.DateTimeShort(DBase.Conv.DateFromDB(Eval("follow_date")))%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Unfoll" HeaderStyle-Width="150px" ItemStyle-HorizontalAlign="Center" SortExpression="unfollow_date">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Font-Size="11px" Text='<%# MyUI.Print.DateTimeShort(DBase.Conv.DateFromDB(Eval("unfollow_date")))%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="From query" HeaderStyle-Width="">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# eval("source_description") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <AlternatingRowStyle CssClass="AlternatingRow Padding2" />
                            <HeaderStyle CssClass="Header" />
                            <EditRowStyle CssClass="EditRow" />
                            <SelectedRowStyle CssClass="SelectedRow" />
                            <RowStyle CssClass="Row Padding2" />
                        </asp:GridView>
                        <App:DataPager runat="server" id="pp3" PageSize="5" Controlid="GridFollowStatus" />

                        <asp:GridView ID="GridFollowSummary" runat="server" Width="100%" AutoGenerateColumns="false" CssClass="summary-results" ShowHeader="true" AllowSorting="true" AllowPaging="True">
                            <Columns>
                                <asp:TemplateField HeaderText="auto follow" HeaderStyle-Width="">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# eval("source_description") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="become follow" HeaderStyle-Width="">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# eval("count_become_follower") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="unfollow" HeaderStyle-Width="">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# Eval("count_unfollower")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="conversione" HeaderStyle-Width="">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# UI.Print.Num0  ( Eval("perc"))%>'></asp:Label>%
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="seg" HeaderStyle-Width="">
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# UI.Print.Num0  ( Eval("seg"))%>'></asp:Label>%
                                    </ItemTemplate>
                                </asp:TemplateField>

                            </Columns>
                            <AlternatingRowStyle CssClass="AlternatingRow Padding2" />
                            <HeaderStyle CssClass="Header" />
                            <EditRowStyle CssClass="EditRow" />
                            <SelectedRowStyle CssClass="SelectedRow" />
                            <RowStyle CssClass="Row Padding2" />
                            <PagerTemplate>
                                <%--<App:GridPager ID="GridPager1" runat="server" />--%>
                            </PagerTemplate>
                        </asp:GridView>
                        <asp:GridView ID="GridMessage" runat="server" ShowHeader="false" CssClass="summary-results last-mentions" Font-Size="10px" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="True" Width="100%">
                            <Columns>
                                <asp:TemplateField ItemStyle-CssClass="thumbsnail">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# eval("url") %>' Target="_blank">
                                        <img src="<%# eval("avatar") %>" />
                                        </asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField ItemStyle-CssClass="description">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" CssClass="re-tweet" NavigateUrl='<%# "https://twitter.com/" & eval("username") %>' Target="_blank">
                                            @<asp:Label runat="server" Text='<%# Eval("username")%>'></asp:Label>    
                                        </asp:HyperLink>

                                        <asp:Label runat="server" CssClass="posted" Text='<%# MyUI.Print.TimeNow(Eval("pubb_date").value)%>'></asp:Label>

                                        <asp:Label runat="server" CssClass="margin-top-5" Text='<%# MyUI.Print.Post(Eval("reply_Post_Text"))%>'></asp:Label>
                                        <br>
                                        <b>my reply</b>:
                                        <asp:Label runat="server" CssClass="margin-top-5" Text='<%# MyUI.Print.Post(Eval("Post_Text"))%>'></asp:Label>

                                        <asp:Button runat="server" ID="LBtShare" CssClass="retweet" Text="Share" CommandName="SHARE" CommandArgument='<%# eval("post_code") %>' />

                                        <input type="submit" class="favorite">
                                        <input type="submit" class="answer">
                                        <input type="submit" class="chat pull-right">
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <AlternatingRowStyle CssClass="Row" />
                            <HeaderStyle CssClass="Header" />
                            <RowStyle CssClass="Row" />
                            <PagerTemplate>
                               <%-- <App:GridPager ID="GridPager1" runat="server" />--%>
                            </PagerTemplate>

                        </asp:GridView>
                    </div>
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>
    </div>



</asp:Content>
